﻿using System;
using UnityEngine;

namespace Yoozoo.Core.Common
{
    [RequireComponent(typeof(SceneTransformDetector))]
    public class DetectorQualityListener : QualityListenerMono<DetectorQualityListener.DetectorQualitySetting>
    {
        [Serializable]
        public class DetectorQualitySetting : QualitySetting
        {
            public Vector3 detectorSize;
            public float cameraOffset;
            public Vector3 offsetPos;
        }

        private SceneTransformDetector _sceneTransformDetector;

        public override void ChangeQualitySetting(DetectorQualitySetting qualitySetting)
        {
            if (_sceneTransformDetector == null)
            {
                _sceneTransformDetector = GetComponent<SceneTransformDetector>();
            }

            _sceneTransformDetector.detectorSize = qualitySetting.detectorSize;
            _sceneTransformDetector.CameraOffset = qualitySetting.cameraOffset;
            _sceneTransformDetector.OffsetPos = qualitySetting.offsetPos;
        }
    }
}